#ifndef __IIC_OLED_H__
#define __IIC_OLED_H__

#include <linux/i2c.h>

#include "iic.h"

#define DEV_CNT                 1
#define CHRDEV_NAME             "oled"

struct iic_dev oleddev;

static int oled_open(struct inode *inode, struct file *filp);
static ssize_t oled_write(struct file *filp, char __user *buf, size_t cnt, loff_t *offt);
static int oled_release(struct inode *inode, struct file *filp);

static int oled_probe(struct i2c_client *client, const struct i2c_device_id *id);
static int oled_remove(struct platform_device *dev);

static void oled_writeChar(char c);
static ssize_t oled_writeCommand(u8 cmd);
static ssize_t oled_writeData(u8 data);
static ssize_t oled_setCursor(u8 page, u8 col);

static void oled_clear(u8 light);
static int oled_init(void);

/* 总线设备注册 */
const struct i2c_device_id iic_device_id[] = {
    {"solomon,ssd1306fb-i2c", 0},
    {}
};

const struct of_device_id iic_of_match[] = {
    { .compatible = "solomon,ssd1306fb-i2c" },
    { /* Sentinel */ }
};

static struct i2c_driver oled_driver = {
    .probe = oled_probe,
    .remove = oled_remove,
    .driver = {
        .owner = THIS_MODULE,
        .name = "ssd1306fb_i2c",
        .of_match_table = iic_of_match,
    },
    .id_table = iic_device_id,
};

#endif
